<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>空间缩放-scaleX、Y、Z、3d</title>
    <style>
        ul {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .nav {
            width: 300px;
            height: 40px;
            margin: 50px auto;
        }

        .nav ul {
            display: flex;
        }

        .nav li {
            width: 100px;
            height: 40px;
            line-height: 40px;
            transition: all .5s;

            /* 设置该元素容器为3D */
            transform-style: preserve-3d;
            position: relative;
            /*transform: rotateX(-20deg) rotateY(30deg);*/

            /* 空间缩放，首先要有一个空间容器 */
            /*transform: scaleX(0.5);*/
            /*transform: scaleY(2);*/
            /*transform: scaleZ(2);*/
            transform: scale3d(0.5, 2, 2);
        }

        .nav li:hover {
            transform: rotateX(-90deg);
        }

        .nav li a {
            display: block;
            width: 100%;
            height: 100%;
            text-align: center;
            text-decoration: none;
            color: #fff;

            position: absolute;
            top: 0;
            left: 0;
        }

        .nav li a:first-child {
            background-color: green;
            transform: translateZ(20px);

        }

        .nav li a:last-child {
            background-color: orange;
            /* 不要先旋转，旋转会改变轴的方向 */
            transform: translateY(-20px) rotateX(90deg);
        }

    </style>
</head>

<body>
<div class="nav">
    <ul>
        <li>
            <a href="#">首页</a>
            <a href="#">Index</a>
        </li>
        <li>
            <a href="#">登录</a>
            <a href="#">Login</a>
        </li>
        <li>
            <a href="#">注册</a>
            <a href="#">Register</a>
        </li>
    </ul>
</div>
</body>

</html>
